package Method_References;

import java.util.Scanner;
import java.util.stream.Stream;

public class number4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一串字符串：");
        String inputstr = sc.next();
        
        char[] arraystr = inputstr.toCharArray();
        
        Stream.of(arraystr)
             .forEach(c -> convertCharacter(c));
    }

    public static void convertCharacter(char[] chars) {
        for (char c : chars) {
            if (Character.isUpperCase(c)) {
                System.out.print((char) ((c - 'A' + 1) % 26 + 'a'));
            } else if (Character.isLowerCase(c)) {
                System.out.print(change(c));
            } else {
                System.out.print(c);
            }
        }
    }

    public static char change(char c) {
        switch (c) {
            case 'a':case'b':case'c':
                return '2';
            case 'd':case'e':case'f':
                return '3';
            case 'g':case'h':case'i':
                return '4';
            case 'j':case'k':case'l':
                return '5';
            case 'm':case'n':case'o':
                return '6';
            case 'p':case'q':case'r':case's':
                return '7';
            case 't':case'u':case'v':
                return '8';
            case 'w':case'x':case'y':case'z':
                return '9';
            case '0':
                return '0';
            default:
                return c;
        }
    }
}
